home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 June: Reference Library / Dev.CD Jun 95 / Dev.CD Jun 95.toast / Technical Documentation / PCI Information / PCI Developer’s Kit (disk) / Expansion Manager / ExpansionBus.h next >
Encoding:
C/C++ Source or Header  |  1994-06-27  |  5.0 KB  |  185 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        ExpansionBus.h
  3.  
  4.     Contains:    Expansion Mgr Device Tree Manipulation Routines
  5.  
  6. */
  7.  
  8. #ifndef __EXPANSIONBUS__
  9. #define __EXPANSIONBUS__
  10.  
  11. #include <Types.h>
  12. #include <OSUtils.h>            /* for sIntQElemPtr */
  13. #include <Devices.h>
  14.  
  15. #define kTypeMask                  0x03        
  16. #define    kDeviceNode                 0x01
  17. #define kPropertyNode             0x02
  18.  
  19. #define kNullAttribute                0
  20. #define kAttributeMask             0x70
  21. #define    kAttributeLocked         0x10
  22. #define kAttributeNVRAM             0x20
  23. #define    kAttributeSystem         0x40
  24.  
  25. #define kAttributeROMProperty     0x80
  26. #define kAttributeDeferred        0x100
  27.  
  28. /*
  29.  * The device tree types
  30.  */
  31.  
  32. typedef void *DeviceTreeNodeID;
  33. typedef DeviceTreeNodeID DeviceNodeID;
  34. typedef DeviceTreeNodeID DevicePropertyID;
  35.  
  36. /*
  37.  * The device tree info structures
  38.  */
  39.  
  40. typedef struct DeviceNodeInfo {
  41.         unsigned long        nodeAttributes;        // attributes of this node
  42.         DeviceNodeID        parentNode;            // cannot be nil, except for the root
  43.         DeviceNodeID        peerNode;            // nil if no peers
  44.         DeviceNodeID        childNode;
  45.         DevicePropertyID    propertyNode;
  46.         char                name[32];            // name of this node
  47. } DeviceNodeInfo;
  48.  
  49. typedef struct DevicePropertyInfo {
  50.         unsigned long        nodeAttributes;        // attributes of this node
  51.         DeviceNodeID        parentNode;            // cannot be nil
  52.         DevicePropertyID    peerNode;            // nil if no peers
  53.         unsigned long        propertySize;        // size of property
  54.         char                name[32];            // name of this node
  55. } DevicePropertyInfo;
  56.  
  57.  
  58. /*
  59.  * The driver services dispatch structure
  60.  * used to call routines needed at interrupt time which may require nested
  61.  * calls (ie. interrupt completion routines on bridges)
  62.  *
  63.  * The actual table dispatch is hidden behind a set of macros
  64.  */
  65.  
  66. #define kExpMgrDrvrSvcTblVersion 0x000a0001
  67.  
  68. typedef struct ExpMgrDrvrSvcTbl {
  69.     unsigned long    version;        // what services we support
  70.     void            (*EnableInt)(void);
  71.     void            (*DisableInt)(void);
  72.     void            (*DismissInt)(void);
  73.     OSErr            (*VBLDispatch)();
  74.     Byte            (*IORdByte)();
  75.     unsigned short    (*IORdWord)();
  76.     unsigned long    (*IORdLong)();
  77.     OSErr            (*IOWrByte)();
  78.     OSErr            (*IOWrWord)();
  79.     OSErr            (*IOWrLong)();
  80. } ExpMgrDrvrSvcTbl;
  81.  
  82. #ifndef _ExpansionBusDispatch
  83. #define _ExpansionBusDispatch 0xAAF3
  84. #endif
  85.  
  86. /*
  87.  * Expansion Manager error codes - numbers will change
  88.  *
  89.  */
  90.  
  91. enum {
  92.     kLockedNode            = -6000,
  93.     kNotEnoughMemory    = -6001,
  94.     kInvalidNodeIDErr    = -6002,
  95.     kNodeNotFound        = -6003,
  96.     kNodeNotCreated        = -6004,
  97.     kDataTruncated        = -6005,
  98.     kInvalidName         = -6006
  99. };
  100.  
  101. /*
  102.  * Expansion Manager C Interface
  103.  *
  104.  */
  105.  
  106. #ifdef __cplusplus
  107. extern "C" {
  108. #endif
  109.  
  110. OSErr DeviceTreeRoot (DeviceNodeID *rootNode)
  111.     = { 0x303c, 0x0204, _ExpansionBusDispatch};
  112.  
  113. OSErr DeviceTreeDeviceInfo (DeviceNodeID nodeID, DeviceNodeInfo *nodeInfo)
  114.     = { 0x303c, 0x0405, _ExpansionBusDispatch};
  115.  
  116. OSErr DeviceTreePropertyInfo (DevicePropertyID nodeID, DevicePropertyInfo *nodeInfo)
  117.     = { 0x303c, 0x0406, _ExpansionBusDispatch};
  118.  
  119. OSErr DeviceTreePeerCount (DeviceNodeID nodeID, unsigned long *count)
  120.     = { 0x303c, 0x040D, _ExpansionBusDispatch};
  121.  
  122. OSErr DeviceTreePropertyCount (DeviceNodeID nodeID, unsigned long *count)
  123.     = { 0x303c, 0x040E, _ExpansionBusDispatch};
  124.  
  125. OSErr DeviceTreeSearch (DeviceNodeID *startNodeID, Byte *targetProperty,
  126.                         Byte *propertyValue, long *PropertySize, Boolean restartSearch)
  127.     = { 0x303c, 0x0A07, _ExpansionBusDispatch};
  128.  
  129. OSErr DeviceTreeNodeSearch (DeviceNodeID nodeID, Byte *targetProperty,
  130.                             DeviceNodeID *propertyNodeID,
  131.                             Byte *propertyData, unsigned long maxSize,
  132.                             unsigned long *actualSize)
  133.     = { 0x303c, 0x0C08, _ExpansionBusDispatch};
  134.  
  135. OSErr DeviceTreeAddDevice (DeviceNodeID parentNodeID, unsigned long attributes,
  136.                            Byte *name, DeviceNodeID *newNode)
  137.     = { 0x303c, 0x0809, _ExpansionBusDispatch};
  138.  
  139. OSErr DeviceTreeDeleteDevice (DeviceNodeID nodeID)
  140.     = { 0x303c, 0x020A, _ExpansionBusDispatch};
  141.  
  142. OSErr DeviceTreeAddProperty (DeviceNodeID parentNodeID, unsigned long attributes,
  143.                              Byte *name, DevicePropertyID *newNode)
  144.     = { 0x303c, 0x080B, _ExpansionBusDispatch};
  145.  
  146. OSErr DeviceTreeDeleteProperty (DevicePropertyID nodeID)
  147.     = { 0x303c, 0x020C, _ExpansionBusDispatch};
  148.  
  149. OSErr DeviceTreeSetProperty (DevicePropertyID nodeID, Byte *userData,
  150.                              unsigned long size)
  151.     = { 0x303c, 0x060F, _ExpansionBusDispatch};
  152.  
  153. OSErr DeviceTreeGetProperty (DevicePropertyID nodeID, Byte *userData,
  154.                              unsigned long size)
  155.     = { 0x303c, 0x0610, _ExpansionBusDispatch};
  156.  
  157. OSErr ExpMgrRegisterBridge (DeviceNodeID nodeID)
  158.     = { 0x303c, 0x0211, _ExpansionBusDispatch};
  159.  
  160. OSErr ExpMgrEnableBridge (DeviceNodeID nodeID)
  161.     = { 0x303c, 0x0212, _ExpansionBusDispatch};
  162.  
  163. OSErr ExpMgrDisableBridge (DeviceNodeID nodeID)
  164.     = { 0x303c, 0x0213, _ExpansionBusDispatch};
  165.  
  166. OSErr ExpMgrInstallISR (QElemPtr sIntQElemPtr, DeviceNodeID nodeID)
  167.     = { 0x303c, 0x0400, _ExpansionBusDispatch};
  168.  
  169. OSErr ExpMgrRemoveISR (QElemPtr sIntQElemPtr, DeviceNodeID nodeID)
  170.     = { 0x303c, 0x0401, _ExpansionBusDispatch};
  171.  
  172. OSErr ExpMgrInstallVBL (QElemPtr sIntQElemPtr, DeviceNodeID nodeID)
  173.     = { 0x303c, 0x0402, _ExpansionBusDispatch};
  174.  
  175. OSErr ExpMgrRemoveVBL (QElemPtr sIntQElemPtr, DeviceNodeID nodeID)
  176.     = { 0x303c, 0x0403, _ExpansionBusDispatch};
  177.  
  178. void AddExpansionDriver (Boolean searchROMMap)
  179.     = { 0x303c, 0x0214, _ExpansionBusDispatch};
  180.  
  181. #ifdef __cplusplus
  182. }
  183. #endif
  184.  
  185. #endif